using System;
using System.Text;
using System.Collections.Generic;
using iBeauty.BusinessObjects;
using iBeauty.DAL;

namespace iBeauty.BLL
{
	public class EmailSettingBLL
	{
		private EmailSettingDAO _EmailSettingDAO;

		public EmailSettingDAO EmailSettingDAO
		{
			get { return _EmailSettingDAO; }
			set { _EmailSettingDAO = value; }
		}

		public EmailSettingBLL()
		{
			EmailSettingDAO = new EmailSettingDAO();
		}
		public List<EmailSetting> GetEmailSettings()
		{
			try
			{
				return EmailSettingDAO.GetEmailSettings();
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}
		public EmailSetting GetEmailSetting(string ID)
		{
			try
			{
				return EmailSettingDAO.GetEmailSetting(ID);
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}
		public int AddEmailSetting(EmailSetting oEmailSetting)
		{
			try
			{
				return EmailSettingDAO.AddEmailSetting(oEmailSetting);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int AddEmailSetting(string ID,DateTime? CreateDate,DateTime? ModifiedDate,DateTime? TimeStamp,string Email,string SmtpUrl,int? SmtpPort,string SmtpUser,string SmtpPassword,string IsSsl,int? AccountId,string Note)
		{
			try
			{
				return EmailSettingDAO.AddEmailSetting(ID,CreateDate,ModifiedDate,TimeStamp,Email,SmtpUrl,SmtpPort,SmtpUser,SmtpPassword,IsSsl,AccountId,Note);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int UpdateEmailSetting(EmailSetting oEmailSetting)
		{
			try
			{
				return EmailSettingDAO.UpdateEmailSetting(oEmailSetting);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int UpdateEmailSetting(string ID,DateTime? CreateDate,DateTime? ModifiedDate,DateTime? TimeStamp,string Email,string SmtpUrl,int? SmtpPort,string SmtpUser,string SmtpPassword,string IsSsl,int? AccountId,string Note)
		{
			try
			{
				return EmailSettingDAO.UpdateEmailSetting(ID,CreateDate,ModifiedDate,TimeStamp,Email,SmtpUrl,SmtpPort,SmtpUser,SmtpPassword,IsSsl,AccountId,Note);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemoveEmailSetting(EmailSetting oEmailSetting)
		{
			try
			{
				return EmailSettingDAO.RemoveEmailSetting(oEmailSetting);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemoveEmailSetting(string ID)
		{
			try
			{
				return EmailSettingDAO.RemoveEmailSetting(ID);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public List<EmailSetting> DeserializeEmailSettings(string Path)
		{
			try
			{
				return GenericXmlSerializer<List<EmailSetting>>.Deserialize(Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public void SerializeEmailSettings(string Path, List<EmailSetting> EmailSettings)
		{
			try
			{
				GenericXmlSerializer<List<EmailSetting>>.Serialize(EmailSettings, Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	}
}
